import java.util.Stack;

public class Text {
    public static void main(String[] args) {
        Stack<String> stack1 = new Stack<>();
        Stack<String> stackMath = new Stack<>();
        Stack<String> stackChar = new Stack<>();
        String[] tokens = {"4","13","5","/","+"};
        for (int i = 0; i < tokens.length; i++) {
            stack1.push(tokens[i]);
        }
        while (!stack1.empty()) {
            if (stack1.peek().equals("+") || stack1.peek().equals("-") || stack1.peek().equals("*") || stack1.peek().equals("/")) {
                stackChar.push(stack1.pop());
            } else {
                stackMath.push(stack1.pop());
            }
        }
        int sum = 0;
        while(!stackChar.empty()){
           if(stackChar.peek().equals("*")){
               stackChar.pop();
               sum = Integer.valueOf(stackMath.pop())*Integer.valueOf(stackMath.pop());
               stackMath.push(String.valueOf(sum));
               continue;
           }
            if(stackChar.peek().equals("/")){
                stackChar.pop();
                sum = Integer.valueOf(stackMath.pop())/Integer.valueOf(stackMath.pop());
                stackMath.push(String.valueOf(sum));
                continue;
            }
            if(stackChar.peek().equals("+")){
                stackChar.pop();
                sum = Integer.valueOf(stackMath.pop())+Integer.valueOf(stackMath.pop());
                stackMath.push(String.valueOf(sum));
                continue;
            }
            if(stackChar.peek().equals("-")){
                stackChar.pop();
                sum = Integer.valueOf(stackMath.pop())-Integer.valueOf(stackMath.pop());
                stackMath.push(String.valueOf(sum));
                continue;
            }
        }
        System.out.println(stackMath.pop());
    }
}
